#ifndef MESSAGE_H
#define MESSAGE_H

#include <memory>

using namespace std;

class IMessage
{
public:
    IMessage();
    virtual ~IMessage();

    bool serialize(uint32_t &size, uint8_t **buffer);
    bool deserialize(uint32_t size, uint8_t *buffer);

protected:
    void setMsgId(uint8_t msgId);
    static const uint32_t SERIALIZED_MSG_HEADER_SIZE;

private:
    class IMessageImpl;
    std::unique_ptr<IMessageImpl> m_pImpl;

    virtual uint32_t getBufferSize() const = 0;
    virtual void serializeContent(uint8_t **buffer) const = 0;
    virtual void deserializeContent(uint8_t **buffer) = 0;
};





#endif // MESSAGE_H
